package cn.mf.hrm.doc;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

/**
 * ES的课程对象
 * @Document :标记该类是一个ES的文档对象
 */
@Document(indexName = "hrm",type = "course")
@Data
public class CourseDoc {

    /**
     * @Id:该字段的值作为Document 的ID
     */
    @Id
    private Long id;

    /**
     * 名字
     */
    @Field(type =FieldType.Text,analyzer = "ik_max_word",searchAnalyzer = "ik_max_word")
    private String name;

    /**
     * 等级名字 ：青铜，白银
     */
    @Field(index = true,type =FieldType.Keyword)
    private String gradeName;

    @Field(index = true,type =FieldType.Keyword)
    private String forUser;

    @Field(index = true,type =FieldType.Long)
    private Long courseTypeId;

    @Field(index = true,type =FieldType.Keyword)
    private String tenantName;

    @Field(index = false,type =FieldType.Keyword)
    private String pic;

    @Field(index = false,type =FieldType.Integer)
    private Integer saleCount;

    @Field(index = false,type =FieldType.Integer)
    private Integer viewCount;

    @Field(index = false,type =FieldType.Integer)
    private Integer commentCount;

    //收费规则：，收费1免费，2收费
    @Field(index = true,type =FieldType.Keyword)
    private String chargeName;

    @Field(type =FieldType.Float)
    private Float price;

    /*课程状态：1已上线，0已下线*/
    @Field(type =FieldType.Integer)
    private Integer status;

    @Field(type =FieldType.Float)
    private Float priceOld;

    @Field(type =FieldType.Date)
    private Date onlineTime;

}
